﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MockupDesigner.Items;
using MockupDesigner.Editors.Controls;

namespace MockupDesigner.Editors.ValidableEditors
{
    public class WebPageEditor : ValidableEditor
    {
        private WebPageEditorControl element;
        private WebPageItem webPage;

        public override void SetItem(ItemBase itemToEdit)
        {
            Element = new WebPageEditorControl(this);
            base.SetItem(itemToEdit);
            webPage = ItemToEdit as WebPageItem;

            element = Element as WebPageEditorControl;
            element.Title = webPage.Title;
            element.Address = webPage.Address;
        }

        public override void Validate()
        {
            base.Validate();
            webPage.Title = this.element.Title;
            webPage.Address = this.element.Address;
        }
    }
}
